<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>可见性选择器</h1>
    <ol>
        <li>:hidden: 选择隐藏的</li>
        <li>:visible: 选择显示的</li>
    </ol>
    <p>p1</p>
    <p>p2</p>
    <p hidden>p3</p>
    <p style="display: none;">p4</p>
    <!-- visibility: hidden jquery:hidden无法选择到 -->
    <p style="visibility: hidden;">p5</p>
    <button>显示</button>
    <button>隐藏</button>
</body>
<script src="../jquery-3.6.0.min.js"></script>
<script>
    $("button:nth-of-type(1)").click(() => {
        // 是p标签，并且是隐藏的，显示出来
        $("p:hidden").show();
    })

    $("button:nth-of-type(2)").click(() => {
        // 是p标签，并且是显示的，进行隐藏
        $("p:visible").hide();
    })
</script>
</html>